let mysql = require('mysql');
let connection = mysql.createConnection({
  host: 'localhost',
  port: 3306,
  user: 'root',
  password: 'yueyuemy',
  database: 'node_stu'
})
connection.connect();

function Db(sql) {
  let res= new Promise((resolve,reject)=>{
    connection.query(sql,(err,results)=>{
      resolve([err,results]);
    });
  });
  return res;
}
module.exports=Db;